@tailwind base;
@tailwind components;
@tailwind utilities;

/* ========================= */
/* Root Variables & Theming  */
/* ========================= */
@layer base {
  @font-face {
    font-family: "JudgeMedium";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(./fonts/F37Judge-MediumExtended.woff2) format("woff2");
  }

  @font-face {
    font-family: "JudgeRegular";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(./fonts/F37Judge-Regular.woff2) format("woff2");
  }

  :root {
    --nextra-primary-hue: 228;
    --nextra-primary-saturation: 61%;
    --nextra-primary-lightness: 44%;
    --nextra-bg: 255 255 255;

    --navy: 228 61% 10%;
    --cyan: 212 100% 86%;
    --brand: hsl(var(--navy));

    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;

    --card: 0 0% 100%;
    --card-foreground: 0 0% 3.9%;

    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 3.9%;

    --primary: 0 0% 9%;
    --primary-foreground: 0 0% 98%;

    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;

    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;

    --accent: 0 0% 96.1%;
    --accent-foreground: 0 0% 9%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;

    --border: 0 0% 89.8%;
    --input: 0 0% 89.8%;
    --ring: 0 0% 3.9%;

    /* Chart Colors */
    --chart-1: 221.2 83.2% 53.3%;
    --chart-2: 212 95% 68%;
    --chart-3: 216 92% 60%;
    --chart-4: 210 98% 78%;
    --chart-5: 212 97% 87%;

    --radius: 0.5rem;
  }

  .dark {
    --nextra-primary-hue: 212;
    --nextra-primary-saturation: 100%;
    --nextra-primary-lightness: 60%;
    --nextra-bg: 2 8 29;

    --brand: hsl(var(--cyan));

    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;

    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;

    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;

    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;

    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;

    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;

    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;

    /* Dark Mode Chart Colors */
    --chart-1: 220 70% 50%;
    --chart-2: 160 60% 45%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
  }
}

/* ========================= */
/* Custom UI Components      */
/* ========================= */
.step-run-card {
  --transition: 0.25s;
  --spark: 3s;
  display: grid;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1000px 0 0 hsl(217.2 32.6% 17.5%) inset;
  transition:
    box-shadow var(--transition),
    background var(--transition),
    transform var(--transition);
}

.step-run-card.active .step-run-backdrop {
  background: var(--background);
}

.step-run-card.active {
  transform: scale(1.05);
}

.step-run-backdrop {
  position: absolute;
  inset: 1px;
  background: var(--background);
  border-radius: 10px;
  transition:
    background var(--transition),
    opacity var(--transition);
}

/* ========================= */
/* Animation Effects         */
/* ========================= */
.spark {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  rotate: 0deg;
  overflow: hidden;
  mask: linear-gradient(white, transparent 50%);
  animation: flip calc(var(--spark) * 2) infinite steps(2, end);
}

@keyframes flip {
  to {
    rotate: 360deg;
  }
}

@keyframes rotate {
  to {
    transform: rotate(90deg);
  }
}

/* ========================= */
/* Dark Mode Fixes (Nextra)  */
/* ========================= */

html
  :is(
    kbd,
    ._border-gray-200,
    .dark\:_border-neutral-800,
    .nx-border,
    .nextra-sidebar-footer,
    .nextra-toc-footer,
    .nextra-code-block pre,
    .nextra-code pre,

  ) {
  @apply border-[color:hsl(var(--border))] dark:border-[color:hsl(var(--border))];
  @apply ring-[color:hsl(var(--border))] dark:ring-[color:hsl(var(--border))];
}

/* ========================= */
/* Code Block Styling        */
/* ========================= */
.shiki {
  padding: 15px !important;
  border-radius: 10px !important;
  background-color: #ccc;
  border-radius: 0.375rem; /* rounded-md */
  font-size: 0.875rem;
  border-width: 1px;
  border-style: solid;
}

html.dark .nextra-code-block pre,
html.dark .nextra-code pre,
.dark .shiki {
  background-color: transparent !important;
  border-color: hsl(var(--border)) !important;
}

pre.shiki {
  overflow-x: auto;
}

/* High contrast mode */
.contrast-more .shiki {
  filter: contrast(1.5);
}

/* ========================= */
/* Miscellaneous Fixes       */
/* ========================= */

h1 {
  font-family: "JudgeMedium", sans-serif;
  font-weight: normal !important;
}

h2,
h3 {
  font-family: "JudgeRegular", sans-serif;
  font-weight: normal !important;
  letter-spacing: 0 !important;
}

.nextra-steps h3::before {
  line-height: 25px;
}

.dark .nextra-breadcrumb a,
.dark .nextra-breadcrumb a:visited,
.dark .nextra-breadcrumb a:hover,
.dark .nextra-breadcrumb a:active {
  background: none !important;
  -webkit-text-fill-color: var(--ash-gray) !important;
}

.nextra-nav-container-blur {
  background-color: var(--background) !important;
}

nav {
  background-color: var(--background) !important;
}

.dark .nx-sticky,
.dark ._sticky {
  box-shadow: none !important;
}
